/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Prestahop_retrievement;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 *
 * @author strokyl
 */
@Embeddable
public class PsProductLangPK implements Serializable {

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_product", nullable = false)
    private PsProduct product;

    @Basic(optional = false)
    @Column(name = "id_shop", nullable = false)
    private int idShop;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_lang", nullable = false)
    private PsLang lang;

    public PsProductLangPK() {
    }

    public PsProductLangPK(PsProduct product, int idShop, PsLang lang) {
        this.product = product;
        this.idShop = idShop;
        this.lang = lang;
    }

    public int getIdShop() {
        return idShop;
    }

    public void setIdShop(int idShop) {
        this.idShop = idShop;
    }

    public PsLang getLang() {
        return lang;
    }

    public void setLang(PsLang lang) {
        this.lang = lang;
    }

    public PsProduct getProduct() {
        return product;
    }

    public void setProduct(PsProduct product) {
        this.product = product;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PsProductLangPK other = (PsProductLangPK) obj;
        if (this.product != other.product && (this.product == null || !this.product.equals(other.product))) {
            return false;
        }
        if (this.idShop != other.idShop) {
            return false;
        }
        if (this.lang != other.lang && (this.lang == null || !this.lang.equals(other.lang))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 97 * hash + (this.product != null ? this.product.hashCode() : 0);
        hash = 97 * hash + this.idShop;
        hash = 97 * hash + (this.lang != null ? this.lang.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "hibernate.PsProductLangPK[product=" + product + ", idShop=" + idShop + ", lang=" + lang + "]";
    }
}
